<!DOCTYPE html>
<html>
<head>
    <title>Binding to local data</title>
    <meta charset="utf-8">
    <link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
    <link href="../../styles/kendo.default.min.css" rel="stylesheet">
    <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet">
    <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet">
    <script src="../../js/jquery.min.js"></script>
    <script src="../../js/kendo.all.min.js"></script>
    <script src="../content/shared/js/console.js"></script>
    <script>
        
    </script>
    
    
</head>
<body>
    
        <a class="offline-button" href="../index.html">Back</a>
    
    <div id="example">
    <div class="demo-section k-content">
    <h2>Website optimization stats</h2>
        <div id="before"></div>
        <div id="after"></div>
    </div>
    <script>
        var dataBefore = [{
            description: "All Visitors",
            visitors: 23945
        }, {
            description: "Tried the Demos",
            visitors: 19156
        }, {
            description: "Downloaded",
            visitors: 13984
        }, {
            description: "Requested a Quote",
            visitors: 3216
        }, {
            description: "Purchased",
            visitors: 1673
        }];

        var dataAfter = [{
            description: "All Visitors",
            visitors: 28536
        },{
            description: "Tried the Demos",
            visitors: 26539
        },{
            description: "Downloaded",
            visitors: 23088
        },{
            description: "Requested a Quote",
            visitors: 13853
        },{
            description: "Purchased",
            visitors: 9697
        }];

        function createChart(chartName, data,description) {
            $("#"+chartName).kendoChart({
                title: {
                    text: description,
                    align: "left",
                    margin: {
                        top: 10,
                        bottom: 10,
                        left: -5
                    }
                },
                legend: {
                    visible: false
                },
                dataSource: {
                    data: data
                },
                series: [{
                    type: "funnel",
                    dynamicSlope:true,
                    field: "visitors",
                    categoryField: "description",
                    dynamicHeight : false,
                    labels: {
                        color:"black",
                        visible: true,
                        background: "transparent",
                        template: "#= category #: #= value#",
                        align: "left"
                    }
                }],
                tooltip: {
                    visible: true,
                    template: "#= category # #= kendo.format('{0:p}',value/dataItem.parent()[0].visitors)#"
                }
            });
        }

        function createCharts() {
            createChart("before", dataBefore, "Before optimization");
            createChart("after", dataAfter, "After optimization");
        }

        $(document).ready(createCharts);
        $(document).bind("kendo:skinChange", createCharts);
    </script>
    <style scoped>
        .chart-wrapper {
            height: 400px;
        }
        .chart-wrapper h2 {
            padding: 20px 0 0 25px;
        }
        .k-chart {
            display: inline-block;
            width: 300px;
            height: 350px;
                
        }

        #before {
            margin-right: 20px;
        }
    </style>
</div>


    
    
</body>
</html>
